package top.wshape1.shiziapi.project.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import top.wshape1.shiziapi.common.domain.ProjectSearch;
import top.wshape1.shiziapi.common.domain.to.DateGapTo;
import top.wshape1.shiziapi.common.utils.R;

import java.util.List;

/**
 * @author Wshape1
 * @version 1.0
 * @description
 * @since 2023-11-26
 */

@FeignClient("shiziapi-search")
public interface SearchFeignService {

    @PostMapping("/elastic/save")
    R<Void> save(@RequestBody ProjectSearch project);

    @PostMapping("/elastic/remove")
    R<Void> remove(@RequestParam("id") Long id);


    @PostMapping("/elastic/like")
    R<Void> like(@RequestParam("count") Long count);

    @PostMapping("/elastic/like/{plusOrReduce}")
    R<Void> likePlusOrReduce(@PathVariable("plusOrReduce") String plusOrReduce, @RequestParam("id") Long id);

    @PostMapping("/elastic/count/read")
    R<Long> countRead(@RequestParam("projectId") Long projectId);

    @PostMapping("/elastic/read/list")
    R<List<ProjectSearch>> readList(@RequestBody DateGapTo to);

    @PostMapping("/elastic/project/hot")
    R<List<ProjectSearch>> hot();

}
